home *** CD-ROM | disk | FTP | other *** search
/ New Perspectives on Computer Concepts / New Perspectives on Computer Concepts.iso / np2010c / page772.pag < prev    next >
Portable Network Graphic  |  2008-10-02  |  97KB  |  817x1045  |  8-bit (256 colors)
Labels: book | hakham | monitor | sky
OCR: 704 SECTION c CHAPTER 1.2 How dol code class when writing a program? Although a pro- grammer typically completes the overall program plan before coding, jump ahead to take quick look at the Java code for the attributes in the Pizza class. The first line of code defines the name of the class Each subse- quent line defines the scope, data type, and name of an attribute The curly brackets simply define the start and end of the class. public string pizzaShape, public double pizzaPri ce; public double pizzas ize; INHERITANCE How flexible are classes for defining different types of objects? The object-oriented paradigm endows classes with quite bit of flexibility For the pizza program, objects and classes make easy to com- pare round pizzas to rectangular pizzas rather than just to square pizzas ...